package com.lmx.repoDomain.tmodel;

import io.katharsis.resource.annotations.JsonApiIncludeByDefault;
import io.katharsis.resource.annotations.JsonApiResource;
import io.katharsis.resource.annotations.JsonApiToOne;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

/**
 * 老人事件
 *
 * @author ytche
 * @date 2017年9月8日
 *
 */
@JsonApiResource(type = "customerEvent")
@Entity
@Table(name = "tnb_customer_event")
public class CustomerEvent extends BaseEntity {
	private static final long serialVersionUID = 1L;
	private String name;
	private Dicttype type;
	private Integer eventTime;
	private Customer customer;
	private Integer eventFlag;// 0自动生成1手动新增
	private String remark;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JsonApiToOne
	@JsonApiIncludeByDefault
	@JoinColumn(name = "type_id")
	public Dicttype getType() {
		return type;
	}

	public void setType(Dicttype type) {
		this.type = type;
	}

	@Column(name = "event_time")
	public Integer getEventTime() {
		return eventTime;
	}

	public void setEventTime(Integer eventTime) {
		this.eventTime = eventTime;
	}

	@ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JsonApiToOne
	@JsonApiIncludeByDefault
	@JoinColumn(name = "customer_id")
	public Customer getCustomer() {
		return customer;
	}

	public void setCustomer(Customer customer) {
		this.customer = customer;
	}

	@Column(name = "event_flag")
	public Integer getEventFlag() {
		return eventFlag;
	}

	public void setEventFlag(Integer eventFlag) {
		this.eventFlag = eventFlag;
	}

	@Column(name = "remark")
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

}
